package com.stock.controller;

import com.entity.Order;
import com.entity.Stock;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.DiscoveryClient;
import com.stock.service.StockService;
import com.utils.Result;
import com.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RefreshScope
public class StockController {
    @Value("${name}")
    private  String name;

    @Autowired
    private StockService stockService;

    @Autowired(required = false)
    DiscoveryClient discoveryClient;

    @GetMapping("/findStock")
    public Result findStock(){
        List<Stock> stockInfo = stockService.findStockInfo();
        System.out.println(name);
        Result result = ResultUtils.ok(stockInfo);
        return result;
    }



}
